import request from '@/util/request';

//获取category详情
export const categoryListWithConditionService=(params)=>{
    return request.get('/category',{params: params});
}
//添加category
export const categoryAddService =(categoryData)=>{
    return request.post('/category',categoryData)
}
//修改category
export const categoryEditService =(productData)=>{
    return request.put('/category',productData)
}
//删除category
export const categoryDeleteService =(categoryId)=>{
    return request.delete('/category?categoryId='+categoryId)
}


//获取分类列表
export const productCategoryListService = ()=>{
    return request.get('/product/categoryList')
}
//获取product详情
export const productListWithConditionService=(params)=>{
    console.log('调用productListWithConditionService'); 
    return request.get('/product',{params: params});
}
//添加product
export const productAddService =(productData)=>{
    return request.post('/product',productData)
}
//修改product
export const productEditService =(productData)=>{
    return request.put('/product',productData)
}
//删除product
export const productDeleteService =(productId)=>{
    return request.delete('/product?productId='+productId)
}



//获取产品列表
export const itemProductListService = ()=>{
    return request.get('/item/productList')
}
//获取Item详情 条件查询
export const itemListWithConditionService=(params)=>{
    return request.get('/item',{params: params});
}   
//添加Item
export const itemAddService =(itemData)=>{
    return request.post('/item',itemData)
}
//修改Item
export const itemEditService =(itemData)=>{
    return request.put('/item',itemData)
}
//删除Item
export const itemDeleteService =(itemId)=>{
    return request.delete('/item?itemId='+itemId)
}
//修改Item状态
export const itemChangeStateService =(itemId,status)=>{
    return request.patch(`/item?itemId=${itemId}&status=${status}`);
}
